//
// Created by user on 2022/3/9.
//
#include <vector>
using namespace std;
vector<int> intersection1(vector<int>& nums1, vector<int>& nums2) {
    vector<int>res;
    for (int n1:nums1) {
        for (int n2:nums2) {
            if(n1==n2){
                if(find(res.begin(), res.end(), n1)==res.end())res.push_back(n1);
            }
        }
    }
    return res;
}

#include <unordered_set>
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
    unordered_set<int> set;
    for (int n1:nums1) {
        for (int n2:nums2) {
            if(n1==n2){
                set.insert(n1);
            }
        }
    }
    vector<int>res(set.begin(), set.end());
    return res;
}
